#pragma once

#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif

#include <qdialog.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qevent.h>
#include "ReadWriteUtils.h"

class QWidgetsGenerate :
    public QDialog
{
    Q_OBJECT

public:
    explicit QWidgetsGenerate(QString text, QWidget* parent = nullptr);
    ~QWidgetsGenerate();

private:
    quint8 m_otaDevType;
    quint32 m_bootFileAddr;
    quint32 m_bootFileSize;
    quint32 m_otaFileAddr;
    quint32 m_otaFileSize;
    quint32 m_appFileAddr;
    quint32 m_appFileSize;
    quint32 m_bakFileAddr;
    quint32 m_bakFileSize;
    ReadWriteUtils utils;

    QLineEdit* m_bootFileCrcLineEdit;
    QLineEdit *m_bootFilePathLineEdit;
    QPushButton* m_bootFileBroserPushButton;
    QLineEdit* m_bootFileSizeLineEdit;
    QLineEdit* m_bootFileOffsetLineEdit;

    QLineEdit* m_appFileCrcLineEdit;
    QLineEdit* m_appFilePathLineEdit;
    QPushButton* m_appFileBroserPushButton;
    QLineEdit* m_appFileSizeLineEdit;
    QLineEdit* m_appFileOffsetLineEdit;

    QLineEdit* m_fwFileNameLineEdit;
    QPushButton* m_fwFileCompositePushButton;
    QLineEdit* m_fwFilePathLineEdit;
    QLineEdit* m_fwFileSizeLineEdit;

    void closeEvent(QCloseEvent* event);

private slots:
    void on_bootFileBroserPushButton_clicked();
    void on_bootFileOffsetLineEdit_textChanged(const QString&);

    void on_appFileBroserPushButton_clicked();
    void on_appFileOffsetLineEdit_textChanged(const QString&);

    void on_fwFileGeneratePushButton_clicked();

    void on_fwFileHasMacth_textChanged(const QString&);
};

